package com.is.add.controller.vo;


import com.is.add.model.SettleDocument;
import com.is.add.util.VoUtil;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * 结算单
 */
public class SettlementVO{
    private Integer settlementId;           //结算单ID
    private Integer shopId;                 //场馆id
    private String shopName;                //场馆名称
    private String shopCode;                //场馆编号
    private String settleNo;                //结算单编号
    private Date settleTime;                //结算单时间
    private Integer orderNum;               //订单数量
    private Integer settleNum;              //场次
    private Integer goodsTotalNum;          //总场次数

    private Double totalSum;                //总金额
    private Double totalFee;                //总服务费

    private Double paySum;                  //支付金额
    private Double memberPaySum;            //会员卡支付额
    private Double aliPaySum;               //支付宝支付额
    private Double wxPaySum;                //微信支付额


    private Double settleSum;               //应结算金额
    private Double realSettleSum;           //实结算金额
    private Double toBeSettleSum;           //待结算金额
    private Double memberSettleSum;         //会员卡结算金额
    private Double aliPaySettleSum;         //支付宝结算金额
    private Double wxSettleSum;             //微信结算金额
    private Double freeSettleSum;           //免费结算金额

    private Double totalSubsidySum;         //总补贴额
    private Double memberSubsidySum;        //会员卡补贴金额
    private Double aliPaySubsidySum;        //支付宝补贴金额
    private Double wxSubsidySum;            //微信补贴金额
    private Double freeSubsidySum;          //免费补贴金额

    private Integer preDepositStatus;       //备用金状态
    private Date optTime;                   //操作时间
    private Integer optUser;                //操作人
    private String settleStatus;            //结算状态
    private String remark;                  //备注

    public SettlementVO() {
    }

    public SettlementVO(Integer z, Double zero) {
        this.orderNum = z;
        this.settleNum = z;
        this.totalSum = zero;
        this.totalFee = zero;
        this.paySum = zero;
        this.memberPaySum = zero;
        this.aliPaySum = zero;
        this.wxPaySum = zero;
        this.settleSum = zero;
        this.realSettleSum = zero;
        this.memberSettleSum = zero;
        this.aliPaySettleSum = zero;
        this.wxSettleSum = zero;
        this.freeSettleSum = zero;
        this.totalSubsidySum = zero;
        this.memberSubsidySum = zero;
        this.aliPaySubsidySum = zero;
        this.wxSubsidySum = zero;
        this.freeSubsidySum = zero;
        this.goodsTotalNum = z;
    }

    public static SettlementVO generateBy(SettleDocument settlement){
        SettlementVO settlementVO = VoUtil.copyBasic(SettlementVO.class, settlement);
        assert settlementVO != null;
        settlementVO.setToBeSettleSum(new BigDecimal(settlement.getSettleSum()-settlement.getRealSettleSum()).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
        switch (settlement.getSettleStatus()){
            case 1:settlementVO.setSettleStatus("未结算");break;
            case 2:settlementVO.setSettleStatus("已生成，待确认");break;
            case 3:settlementVO.setSettleStatus("已确认，待审核");break;
            case 4:settlementVO.setSettleStatus("已审核，待付款");break;
            case 5:settlementVO.setSettleStatus("已付款");break;
        }
        return settlementVO;
    }
    public static List<SettlementVO> generateBy(List<SettleDocument> settlementList){
        List<SettlementVO> list= new ArrayList<>();
        for (SettleDocument settlement:settlementList){
            list.add(generateBy(settlement));
        }
        return list;
    }

    public Integer getGoodsTotalNum() {
        return goodsTotalNum;
    }

    public void setGoodsTotalNum(Integer goodsTotalNum) {
        this.goodsTotalNum = goodsTotalNum;
    }

    public Integer getOrderNum() {
        return orderNum;
    }

    public void setOrderNum(Integer orderNum) {
        this.orderNum = orderNum;
    }

    public Integer getSettlementId() {
        return settlementId;
    }

    public void setSettlementId(Integer settlementId) {
        this.settlementId = settlementId;
    }

    public String getSettleNo() {
        return settleNo;
    }

    public void setSettleNo(String settleNo) {
        this.settleNo = settleNo;
    }

    public Date getSettleTime() {
        return settleTime;
    }

    public void setSettleTime(Date settleTime) {
        this.settleTime = settleTime;
    }

    public Integer getSettleNum() {
        return settleNum;
    }

    public void setSettleNum(Integer settleNum) {
        this.settleNum = settleNum;
    }

    public Date getOptTime() {
        return optTime;
    }

    public void setOptTime(Date optTime) {
        this.optTime = optTime;
    }

    public Double getSettleSum() {
        return settleSum;
    }

    public void setSettleSum(Double settleSum) {
        this.settleSum = settleSum;
    }

    public Integer getOptUser() {
        return optUser;
    }

    public void setOptUser(Integer optUser) {
        this.optUser = optUser;
    }

    public Integer getShopId() {
        return shopId;
    }

    public void setShopId(Integer shopId) {
        this.shopId = shopId;
    }

    public String getSettleStatus() {
        return settleStatus;
    }

    public void setSettleStatus(String settleStatus) {
        this.settleStatus = settleStatus;
    }

    public Double getRealSettleSum() {
        return realSettleSum;
    }

    public void setRealSettleSum(Double realSettleSum) {
        this.realSettleSum = realSettleSum;
    }


    public Double getTotalFee() {
        return totalFee;
    }

    public void setTotalFee(Double totalFee) {
        this.totalFee = totalFee;
    }

    public Double getPaySum() {
        return paySum;
    }

    public void setPaySum(Double paySum) {
        this.paySum = paySum;
    }

    public Double getMemberPaySum() {
        return memberPaySum;
    }

    public void setMemberPaySum(Double memberPaySum) {
        this.memberPaySum = memberPaySum;
    }

    public Double getAliPaySum() {
        return aliPaySum;
    }

    public void setAliPaySum(Double aliPaySum) {
        this.aliPaySum = aliPaySum;
    }

    public Double getWxPaySum() {
        return wxPaySum;
    }

    public void setWxPaySum(Double wxPaySum) {
        this.wxPaySum = wxPaySum;
    }

    public Double getMemberSettleSum() {
        return memberSettleSum;
    }

    public void setMemberSettleSum(Double memberSettleSum) {
        this.memberSettleSum = memberSettleSum;
    }

    public Double getAliPaySettleSum() {
        return aliPaySettleSum;
    }

    public void setAliPaySettleSum(Double aliPaySettleSum) {
        this.aliPaySettleSum = aliPaySettleSum;
    }

    public Double getTotalSum() {
        return totalSum;
    }

    public void setTotalSum(Double totalSum) {
        this.totalSum = totalSum;
    }

    public Double getWxSettleSum() {
        return wxSettleSum;
    }

    public void setWxSettleSum(Double wxSettleSum) {
        this.wxSettleSum = wxSettleSum;
    }

    public Double getTotalSubsidySum() {
        return totalSubsidySum;
    }

    public void setTotalSubsidySum(Double totalSubsidySum) {
        this.totalSubsidySum = totalSubsidySum;
    }

    public Double getMemberSubsidySum() {
        return memberSubsidySum;
    }

    public void setMemberSubsidySum(Double memberSubsidySum) {
        this.memberSubsidySum = memberSubsidySum;
    }

    public Double getAliPaySubsidySum() {
        return aliPaySubsidySum;
    }

    public void setAliPaySubsidySum(Double aliPaySubsidySum) {
        this.aliPaySubsidySum = aliPaySubsidySum;
    }

    public Double getWxSubsidySum() {
        return wxSubsidySum;
    }

    public void setWxSubsidySum(Double wxSubsidySum) {
        this.wxSubsidySum = wxSubsidySum;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getShopName() {
        return shopName;
    }

    public void setShopName(String shopName) {
        this.shopName = shopName;
    }

    public String getShopCode() {
        return shopCode;
    }

    public void setShopCode(String shopCode) {
        this.shopCode = shopCode;
    }

    public Double getFreeSettleSum() {
        return freeSettleSum;
    }

    public void setFreeSettleSum(Double freeSettleSum) {
        this.freeSettleSum = freeSettleSum;
    }

    public Double getFreeSubsidySum() {
        return freeSubsidySum;
    }

    public void setFreeSubsidySum(Double freeSubsidySum) {
        this.freeSubsidySum = freeSubsidySum;
    }

    public Integer getPreDepositStatus() {
        return preDepositStatus;
    }

    public void setPreDepositStatus(Integer preDepositStatus) {
        this.preDepositStatus = preDepositStatus;
    }

    public Double getToBeSettleSum() {
        return toBeSettleSum;
    }

    public void setToBeSettleSum(Double toBeSettleSum) {
        this.toBeSettleSum = toBeSettleSum;
    }
}
